package com.service.impl;

import com.dao.impl.loginDaoimpl;
import com.dao.loginDao;
import com.domain.Student;
import com.service.loginService;

import java.util.List;

public class loginServiceimpl implements loginService {
    //登录方法
    @Override
    public Student login(Student student) {
        //调用Dao里的方法,获取所有数据
        loginDao lonindao=new loginDaoimpl();
        List<Student> students = lonindao.selectAll();
        for (Student student1 : students) {
            if (student1.getId().equals(student.getId())&&student1.getPassword().equals(student.getPassword())){
                return student1;
            }
        }
        return null;
    }
}
